<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app"></div>
<script src="../../JavaScript/vue.js"></script>
<script>
    <!--children组件-->
    const children = {
        template: `<h3>{{ this.message }}</h3>`,
        data() {
            return {
                message: "我是children组件"
            }
        },
    }
    // App根组件
    const App = {
        template: `
          <div class="app">
            <children></children>
            <h3>{{ this.message }}</h3>
            <button @click="getMessage">点击</button>
          </div>`,
        data() {
            return {
                message: "HelloVue3"
            }
        },
        methods: {
            getMessage() {
                console.log(this.message)
            }
        },
        components: {
            children
        }
    }
    // 创建一个App的实例
    const app = Vue.createApp(App)
    // 挂载实例
    app.mount("#app")
</script>
</body>
</html>